@extends('admin.layout.basic')
@section('content')
        <!-- 面包屑 -->
@include('admin.layout.breadcrumb')
<div class="wrapper wrapper-content animated fadeInRight ecommerce">

    <div class="row">
        <div class="form-group">
            <div class="col-sm-8 col-sm-offset-2">
                <div id="com_message"  name="com_message"  class="text-danger text-center" ></div>
            </div>
        </div>
        <div class="col-lg-12">
            <div class="tabs-container">
                <ul class="nav nav-tabs">
                    <li class="active"><a data-toggle="tab" href="#tab-1">{{trans("admin/message.tag_basic")}}</a></li>
                    <li class=""><a data-toggle="tab" href="#tab-2"> {{trans("admin/message.tag_c_a")}}</a></li>
                    <li class=""><a data-toggle="tab" href="#tab-3"> {{trans("admin/message.tag_seo")}}</a></li>
                    <li class=""><a data-toggle="tab" href="#tab-4"> {{trans("admin/message.tag_other")}}</a></li>
                    <li class="" style="display:  @if(isset($post) && $post->id != null) block @else none @endif;"><a data-toggle="tab" href="#tab-5"> {{trans("admin/message.tag_histroy")}}</a></li>
                </ul>
                <div class="tab-content" id="post_content_div">
                    <div id="tab-1" class="tab-pane active">
                        <div class="panel-body">
                            <!--编号 -->
                            <input id="id" name="id" value="{{ isset($post) ? $post->id : '' }}" type="hidden">
                            <fieldset class="form-horizontal">



                                <div class="form-group"><label class="col-sm-2 control-label">{{trans("admin/message.title")}}:</label>
                                    <div class="col-sm-10">
                                        <input id="title" name="title" type="text" class="form-control"
                                                placeholder="{{trans("admin/message.title")}}"
                                                value="{{ isset($post) ? $post->title : '' }}">
                                        </div>

                                </div>

                                <div class="form-group"><label class="col-sm-2 control-label">{{trans("admin/message.content")}}:</label>
                                    <div class="col-sm-10">
                                        <div id="post_content" class="summernote">
                                            @if (isset($post))
                                                {!! $post->post_content !!}
                                            @endif
                                        </div>
                                    </div>
                                </div>

                            </fieldset>
                        </div>
                    </div>
                    <div id="tab-2" class="tab-pane">
                        <div class="panel-body">

                            <fieldset class="form-horizontal">
                                <div class="form-group"><label class="col-sm-2 control-label">{{trans("admin/message.category_parent")}}</label>
                                    <div class="col-sm-8">
                                        <input type="text" id="category_name" disabled name="category_name"  value="{{isset($post) ? $post->category_name : ''}}"
                                               class="form-control">
                                        <input type="hidden" id="category_id" name="category_id" value="{{isset($post) ? $post->category_id : ''}}" >
                                    </div>
                                    <button type="button" onclick="admin_post_edit.openModel()" class="btn btn-success">{{trans("admin/message.chose")}}</button>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">{{trans("admin/message.post_tags")}}</label>
                                    <div class="col-sm-8">
                                        <select  type="text" id="category_tags"  class="select2 input-default form-control" multiple
                                                 name="category_tags"  value="{{isset($post) ? $post->category_tags : ''}}"  >
                                        </select>
                                    </div>

                                </div>
                            </fieldset>


                        </div>
                    </div>
                    <div id="tab-3" class="tab-pane">

                        <div class="panel-body">
                            <fieldset class="form-horizontal">
                                <div class="form-group"><label class="col-sm-2 control-label">{{trans("admin/message.seo_check")}}:</label>
                                    <div class="col-sm-10">
                                        <div class="i-checks"><label> <input type="checkbox" id="use_seo" name="use_seo" {{ isset($post) ? ($post->use_seo == 1? "checked":"") : '' }} ></label></div> </div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">{{trans("admin/message.seo_title")}}:</label>
                                    <div class="col-sm-10"><input type="text" name="seo_title" class="form-control"  value="{{isset($post) ? $post->seo_title : ''}}" ></div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">{{trans("admin/message.seo_description")}}:</label>
                                    <div class="col-sm-10"><input type="text" name="seo_description" class="form-control"  value="{{isset($post) ? $post->seo_description : ''}}"></div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">{{trans("admin/message.seo_keywords")}}:</label>
                                    <div class="col-sm-10"><input type="text" name="seo_keywords" class="form-control"  value="{{isset($post) ? $post->seo_keywords : ''}}"></div>
                                </div>
                                <div class="form-group"><label class="col-sm-2 control-label">{{trans("admin/message.seo_other_meta")}}:</label>
                                    <div class="col-sm-10"><textarea type="text" name="seo_meta" class="form-control"  >{{isset($post) ? $post->seo_meta : ''}} </textarea> </div>
                                </div>
                            </fieldset>
                        </div>
                    </div>
                    <div id="tab-4" class="tab-pane">
                        <div class="panel-body">

                            <fieldset class="form-horizontal">

                            @foreach($postpros as $pitem)
                                    <div class="form-group"><label class="col-sm-2 control-label">{{$pitem->name}}:</label>
                                        <div class="col-sm-10"><input type="text" name="{{$pitem->uid}}" class="form-control"
                                                                      value="{{isset($post) && isset($post->attribute)? $post->attribute[$pitem->uid] : ''}}" ></div>
                                    </div>
                                @endforeach
                            </fieldset>

                        </div>
                    </div>
                    <div id="tab-5" class="tab-pane">
                        <div class="panel-body" id="historyform">



                            @if(isset($post) && $post->historylist != null)
                                @foreach($post->historylist  as $item)

                                    <fieldset  id="histroy{{$item->id}}" class="form-horizontal" >

                                        @if($post->history && $post->history == $item->id)
                                            <div   class="form-group">
                                                <label   class="col-sm-4 control-label"  style="color: green"  >{{$item->created_at}}   </label>
                                                <label   class="col-sm-4 control-label"  style="color: green"  > {{$item->title}}  </label>
                                                <div class="col-sm-4">
                                                    <a     disabled href="javascript:void(0)"   class="btn btn-sm btn-primary">{{ trans('admin/message.approval') }}</a>
                                                    <button onclick="admin_post_edit.deleteHistory({{$item->id}})"  disabled class="btn  btn-sm btn-danger">{{ trans('admin/message.delete') }}</button>
                                                </div>
                                            </div>
                                        @else
                                            <div   class="form-group">
                                                <label   class="col-sm-4 control-label"   >{{$item->created_at}}   </label>
                                                <label   class="col-sm-4 control-label"    > {{$item->title}}  </label>
                                                <div class="col-sm-4">
                                                    <a       href="/admin/post/create?id={{$post->id}}&history={{$item->id}}"   class="btn btn-sm btn-primary">{{ trans('admin/message.approval') }}</a>
                                                    <button onclick="admin_post_edit.deleteHistory({{$item->id}})"   class="btn  btn-sm btn-danger">{{ trans('admin/message.delete') }}</button>
                                                </div>
                                            </div>
                                        @endif


                                    </fieldset>
                                @endforeach
                            @endif



                        </div>
                    </div>

                </div>

            </div>

        </div>
        <div class="col-lg-12 ">
                <div class="col-lg-12 ibox-content  text-center">

                    <button type="button" onclick="admin_post_edit.public()" class="btn btn-w-m btn-success">{{ trans('admin/message.public') }}</button>
                    <button type="button"  onclick="admin_post_edit.draft()"class="btn btn-w-m btn-warning">{{ trans('admin/message.draft') }}</button>
                </div>

        </div>

        @include('admin.cms.modules.post_category_select')

    </div>

</div>

@endsection




